#include "main.h"
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "usr_cfg.h"
#include "usr_typedef.h"
#include "watchdog_thread.h"
#include "zlog.h"


extern sys_cfg_info		sys_cfg;

void *watchdog_thread(void *arc)
{
	thread_status *s = NULL;

	printf("watchdog thread initial is complete!\n");
	
	if(arc == NULL)
		return NULL;

	s = (thread_status*)arc;
	s->status = TS_ALIVE;

	while (s->status) 
	{
	/*
	  system("echo s > /dev/watchdog1");
	  
	  if (sys_cfg.debug == ON) {
		  printf("feed the pl watchdog\n");
	  }
	*/
	  sleep(WATCHDOG_INTERVAL_DELAY);
	}

	dzlog_notice("watchdog thread exit!!!");
	printf("watchdog thread exit!!!\n");
	s->status = TS_TERMINATED;
	pthread_exit(arc);
}


